#include "DataMaintenanceService.hpp"
#include "stdio.h"
/* RTOS */
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
/* 接口库 */
#include "SpindleMotor.hpp"
#include "CompressorMotor.hpp"
#include "L2DataSet.hpp"
#include "DataAccessor.hpp"

static TaskHandle_t data_maintenance_task;
static void DataMaintenanceService_task(void * param){

    SpindleMotor * spindle_motor = SpindleMotor::getInstance();
    CompressorMotor * commpressor_motor = CompressorMotor::getInstance();
    DataAccessor * data_accessor = DataAccessor::getInstance();
    while(true){

        vTaskDelay(100);
        data_accessor->set("compressor.speedActual",(double)commpressor_motor->getSpeedActual());


    }
}

bool DataMaintenanceService::run(){

    xTaskCreate(DataMaintenanceService_task,"data_maintenance_task",256,nullptr,1,&data_maintenance_task);
    return true;
}



